package tst.testtask.controllers;

import java.time.LocalDate;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import lombok.RequiredArgsConstructor;
import tst.testtask.request.dto.ResultResponseDTO;
import tst.testtask.services.RequestService;

@RequiredArgsConstructor
@RequestMapping("/testtask")
@RestController
public class RequestController {

    private final RequestService requestService;

    @GetMapping("/bykey/getjson")
    public ResultResponseDTO<Object> getRecordFromDB(@RequestParam Integer key) {
        ResultResponseDTO<Object> result = requestService.getRecordFromDB(key);
        return result;
    }
}
